<include file="public@header"/>
<link href="__STATIC__/css/layui.css" rel="stylesheet" />
<link href="__STATIC__/css/admin.css" rel="stylesheet" />
</head>
<body>
<div class="wrap">
    <div class="row">
        <div class="layui-card-body">
            <div class="layui-carousel layadmin-carousel layadmin-backlog" lay-anim="" lay-indicator="inside" lay-arrow="none" style="width: 100%; height: 80px!important;">
                <div carousel-item="">
                    <ul class="layui-row layui-col-space10 layui-this">
                        <li class="layui-col-xs3">
                            <a href="javascript:;" class="layadmin-backlog-body">
                                <h3>总用户数</h3>
                                <p><cite>{$total_num}</cite>人</p>
                            </a>
                        </li>
                        <li class="layui-col-xs3">
                            <a href="javascript:;" class="layadmin-backlog-body">
                                <h3>今日新用户数</h3>
                                <p><cite>{$today_num}</cite>人</p>
                            </a>
                        </li>
                        <li class="layui-col-xs3">
                            <a href="javascript:;" class="layadmin-backlog-body">
                                <h3>本月新用户数</h3>
                                <p><cite>{$month_num}</cite>人</p>
                            </a>
                        </li>
                        <li class="layui-col-xs3">
                            <a href="javascript:;" class="layadmin-backlog-body">
                                <h3>用户总资产</h3>
                                <p><cite>{$balance_sum}</cite>USDT</p>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <ul class="nav nav-tabs">
        <li class="active"><a>用户列表</a></li>
        <li><a href="{:url('admin_index/add')}">新增用户</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('user/adminIndex/index')}">
        用户ID：
        <input class="form-control" type="text" name="uid" style="width: 200px;" value="{:input('request.uid')}"
               placeholder="请输入用户ID">
        关键字：
        <input class="form-control" type="text" name="keyword" style="width: 200px;" value="{:input('request.keyword')}"
               placeholder="邮箱/手机">
        状态
        <select class="form-control" name="user_status" style="width: 100px;">
            <option value="">---请选择---</option>
            <option value="1" <if input('user_status') == 1 && input('user_status') != null>selected</if> >正常</option>
            <option value="0" <if input('user_status') == 0 && input('user_status') != null>selected</if> >拉黑</option>
        </select>
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:url('user/adminIndex/index')}">清空</a>
        <a class="btn btn-success" href="{:url('user/adminIndex/export',array('uid'=>input('uid'),'keyword'=>input('keyword'),'user_status'=>input('user_status')))}" target="_blank">导出</a>
    </form>
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>ID</th>
                <th>手机</th>
                <th>{:lang('EMAIL')}</th>
                <th>当前登录IP</th>
                <th>{:lang('REGISTRATION_TIME')}</th>
                <th>邀请码</th>
                <th>推荐人</th>
                <th>会员等级</th>
                <th>等级变更时间</th>
                <th>是否董事</th>
                <th>币种</th>
                <th>余额</th>
                <th>提现中</th>
                <th>提现</th>
                <th>充值</th>
                <th>个人盈亏</th>
                <th>伞下盈亏</th>
                <th>伞下余额</th>
                <th>伞下余额为0数量</th>
                <th>{:lang('STATUS')}</th>
                <th>{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <php>
                $user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));
            </php>
            <foreach name="list" item="vo">
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.mobile}</td>
                    <td>{$vo.user_email}</td>
                    <td>{$vo.last_login_ip}</td>
                    <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
                    <td>{$vo.invitation_code}</td>
                    <td>{:recommender_info($vo.recommender_code)}</td>
                    <td>{$vo.level_name}</td>
                    <td><if $vo.level_date>{:date('Y-m-d',$vo.level_date)}</if></td>
                    <td><if $vo.director>是<else/>否</if></td>
                    <td>USDT</td>
                    <td>{:floatval($vo.balance)}</td>
                    <td>{:floatval($vo.frozen_balance)}</td>
                    <td>{:tixian($vo.id)}</td>
                    <td>{:chongzhi($vo.id)}</td>
                    <td>{:floatval($vo.profit_loss)}</td>
                    <td>{:down_profit_loss($vo.id)}</td>
                    <td>{:down_balance($vo.id)}</td>
                    <td>{:down_num_zero($vo.id)}</td>
                    <td>
                        <switch name="vo.user_status">
                            <case value="0">
                                <span class="label label-danger">{$user_statuses[$vo['user_status']]}</span>
                            </case>
                            <case value="1">
                                <span class="label label-success">{$user_statuses[$vo['user_status']]}</span>
                            </case>
                            <case value="2">
                                <span class="label label-warning">{$user_statuses[$vo['user_status']]}</span>
                            </case>
                        </switch>
                    </td>
                    <td>
                        <a class="btn btn-xs btn-primary" href="{:url('adminIndex/edit',array('id'=>$vo['id']))}">编辑</a>
                        <if condition="cmf_auth_check(cmf_get_current_admin_id(),'user/adminIndex/chongzhi')">
                            <a class="btn btn-xs btn-primary chongzhi" data-id="{$vo.id}">充值</a>
                        </if>
                        <a class="btn btn-xs btn-primary" href="{:url('adminIndex/level',array('id'=>$vo['id']))}">会员等级</a>
                        <a class="btn btn-xs btn-primary" href="{:url('adminIndex/director',array('id'=>$vo['id']))}">董事设置</a>
                        <a class="btn btn-xs btn-primary" href="javascript:parent.openIframeLayer('{:url('adminIndex/address',array('id'=>$vo['id']))}','地址',{area:['600px','300px']});">地址</a>
                        <a class="btn btn-xs btn-primary" href="javascript:parent.openIframeLayer('{:url('adminIndex/balance_log',array('id'=>$vo['id']))}','资金记录',{area:['600px','80%']});">资金记录</a>
                        <neq name="vo.id" value="1">
                            <empty name="vo.user_status">
                                <a class="btn btn-xs btn-success js-ajax-dialog-btn"
                                   href="{:url('adminIndex/cancelban',array('id'=>$vo['id']))}"
                                   data-msg="{:lang('ACTIVATE_USER_CONFIRM_MESSAGE')}">{:lang('ACTIVATE_USER')}</a>
                                <else/>
                                <a class="btn btn-xs btn-warning js-ajax-dialog-btn"
                                   href="{:url('adminIndex/ban',array('id'=>$vo['id']))}"
                                   data-msg="{:lang('BLOCK_USER_CONFIRM_MESSAGE')}">{:lang('BLOCK_USER')}</a>
                            </empty>
                            <else/>
                            <a class="btn btn-xs btn-warning disabled">{:lang('BLOCK_USER')}</a>
                        </neq>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <div class="pagination">{$page}</div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/layui/layui.js"></script>
<script type="text/javascript">
layui.use('layer',function(){
    $('.chongzhi').click(function(){
        var id = $(this).data('id');
        layer.prompt({title:'充值金额'},function(value, index, elem){
            $.ajax({
                type: 'post',
                url: '{:url("user/adminIndex/chongzhi")}',
                data: {id:id,value:value},
                success:function(res){
                    if(res.code == 1){
                        layer.close(index);
                        setTimeout(function(){ location.reload(); }, 1500);
                    }
                    layer.msg(res.msg)
                }
            });
        });
    });
});
</script>
</body>
</html>